package cn.edu.lnpu.domain.cms.response;

import cn.edu.lnpu.common.model.response.CommonCode;
import cn.edu.lnpu.common.model.response.ResponseResult;
import cn.edu.lnpu.common.model.response.ResultCode;
import cn.edu.lnpu.domain.cms.CmsPage;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.checkerframework.checker.units.qual.C;

@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Data
public class CmsPageResult extends ResponseResult {
    CmsPage cmsPage;
    public CmsPageResult(ResultCode resultCode, CmsPage cmsPage) {
        super(resultCode);
        this.cmsPage = cmsPage;
    }

    public static CmsPageResult SUCCESS(){
        return SUCCESS(null);
    }

    public static CmsPageResult SUCCESS(CmsPage cmsPage){
        if (cmsPage == null) {
            cmsPage = new CmsPage();
        }
        return new CmsPageResult(CommonCode.SUCCESS,cmsPage);
    }
    public static CmsPageResult FAIL(){
        return new CmsPageResult(CommonCode.FAIL,new CmsPage());
    }
}
